import { applyMiddleware, createStore } from 'redux';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import reducer from '../reducers/index';
import reduxPromise from 'redux-promise-middleware';

let middlewares = [thunk, reduxPromise];

if (process.env.NODE_ENV === 'development') {
    middlewares.push(logger)
}

export const store = createStore(
    reducer,
    applyMiddleware(...middlewares)
)
